home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 05.zip / BS1 part 5 / PDraw3.0.adf / pdraw_rex.lzh / Flower.pdrx < prev    next >
Text File  |  1992-05-17  |  2KB  |  89 lines

  1. /*
  2. @N
  3.  
  4. This Genie will draw flower like objects on the screen
  5. */
  6.  
  7. msg = PDSetup.rexx(2,0)
  8. units = getclip(pds_units)
  9. if msg ~= 1 then exit_msg(msg)
  10.  
  11. numeric digits 8
  12.  
  13. call PDM_setbatchmode(0)
  14. call PDM_autoupdate(0)
  15.  
  16. pi = 3.14159
  17. pi2 = 6.28318
  18. cr = '0a'x
  19.  
  20. call pdm_unselectobj()
  21. man = pdm_getform("Flower Specificaitons",4,"petals:6"cr"sharpness:1.2"cr"Steps:9")
  22. if man = '' then exit_msg()
  23. parse var man order '0a'x sharp '0a'x stepval
  24.  
  25. if ~(datatype(order,n) & datatype(sharp, n) & datatype(stepval, n)) then 
  26.     exit_msg("Invalid Entry")
  27.  
  28. sharp = (sharp+1) * pi/2
  29. curcolor = pdm_GetFillPattern()
  30. parse var curcolor type '0a'x curcolor .
  31.  
  32. color = pdm_SetFillPattern(,1,"Red")
  33. color = pdm_SetFillPattern(,1)
  34. parse var color filler '0a'x color '0a'x filler
  35. if color = '' then exit_msg()
  36. call pdm_setfillpattern(,1,color,)
  37.  
  38. color = pdm_getcolordata(color)
  39. red = word(color,1)
  40. green = word(color,2)
  41. blue = word(color,3)
  42.  
  43. b = PDM_getclickposn("Where do you want the center of the flower?")
  44.  
  45. posx = word(b,1)
  46. posy = word(b,2)
  47. petal = ""
  48.  
  49. do steps = 0 to order-1
  50.  
  51.    theta = pi2 * steps / order
  52.    x = cos(theta) * 1
  53.    y = sin(theta) * 1
  54.    tx = cos(theta - sharp) * 1
  55.    ty = sin(theta - sharp) * 1
  56.    sx = cos(theta + sharp) * 1
  57.    sy = sin(theta + sharp) * 1
  58.    petal = petal || x" "y" "tx " "ty" "sx" "sy
  59.    if (steps < order -1) then petal = petal","
  60.  
  61. end
  62.  
  63. do i = stepval to 0 by -1
  64.  
  65.    rgb = 1 - i/15
  66.    scale = i * .125 + 0.5
  67.    ang = i * 36
  68.    call PDM_initplot(posx ,posy ,scale,scale,ang)
  69.    call PDM_plotbezier(petal)
  70.    obj = PDM_closeplot()
  71.    colour = "UNNAMED RGB "red*rgb" "green*rgb" "blue*rgb
  72.    call PDM_setfillpattern(obj,1,colour,)
  73.  
  74. end
  75.  
  76. exit_msg("")
  77.  
  78.  
  79. exit_msg: procedure expose units
  80. do
  81.     parse arg message
  82.  
  83.     if message ~= '' then call pdm_Inform(1,message,)
  84.     call pdm_AutoUpdate(1)
  85.     call pdm_SetUnits(units)
  86.     call pdm_SetBatchMode(0)
  87.     exit
  88. end
  89.